<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>getrusage</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_005_722">&nbsp;</a>NAME</h4><blockquote>
getrusage - get information about resource utilisation
</blockquote><h4><a name = "tag_000_005_723">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="sysresource.h.html">sys/resource.h</a>&gt;

int getrusage(int <i>who</i>, struct rusage *<i>r_usage</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_005_724">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>getrusage()</i>
function provides measures of
the resources used by the current process or its terminated and
waited-for child processes.  If the value of the <i>who</i> argument is
RUSAGE_SELF, information is returned about resources used
by the current process.
If the value of the <i>who</i> argument is RUSAGE_CHILDREN,
information is returned about resources used by the terminated and
waited-for children of the current process.
If the child is never waited for (for instance, if the parent has
SA_NOCLDWAIT set or sets SIGCHLD to SIG_IGN), the resource
information for the child process is discarded and not included
in the resource information provided by
<i>getrusage()</i>.
<p>
The <i>r_usage</i> argument is a pointer to an object of type <b>struct
rusage</b> in which the returned information is stored.
</blockquote><h4><a name = "tag_000_005_725">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion,
<i>getrusage()</i>
returns 0.  Otherwise, -1 is returned, and <i>errno</i> is set to indicate
the error.
</blockquote><h4><a name = "tag_000_005_726">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>getrusage()</i>
function will fail if:
<dl compact>

<dt>[EINVAL]<dd>
The value of the <i>who</i> argument is not valid.

</dl>
</blockquote><h4><a name = "tag_000_005_727">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_728">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_729">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_730">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="exit.html">exit()</a></i>,
<i><a href="sigaction.html">sigaction()</a></i>,
<i><a href="time.html">time()</a></i>,
<i><a href="times.html">times()</a></i>,
<i><a href="wait.html">wait()</a></i>,
<i><a href="sysresource.h.html">&lt;sys/resource.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
